﻿<html>
	<head>
    <title>Getting Started</title>
    <link rel="stylesheet" type="text/css" href="../assets/styles/default.css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script>
		<script type="text/javascript" src="../assets/scripts/base.js"></script>
	</head>
	<body id="content">
		<h1>Getting Started With SudzC</h1>
		<p>
			SudzC is a tool for generating proxy code from web service definition files (WSDL).  
			This documentation was generated to help you get started with SudzC immediately.
		</p>
		
		<h2>Using this documentation</h2>
		<p>
			This documentation is design to allow you to reference your newly generated code base.
			To get started, click on a package on the left.  This will reveal the service methods that are available.
			You can then go directly into a class reference by clicking a link on the left-side navigation, 
			or by clicking on inline links on the right.  This lets you traverse the code hierarchy.
		</p>
		<p>To get back to this screen, simply click the "All Packages" link at the top of the navigation, followed by the "Getting Started" link to return here.</p>
		
		<h2>The example project</h2>
		<p>
			In addition to this documentation and the generated code files, a sample project has been created.
			You can open this project and get started right now.  This includes real code samples and fragments to jump in quickly.
		</p>

		<h2>How to use generated code</h2>
		<p>To make a web service call, you first create an instance of your service class.
		This should be the one named after the class you used to make your web services.  
		For instance, if you are dealing with Widgets, you may have WidgetService.  
		This will translate into an Objective-C class.
		To use it, you must first include it by adding script includes to the head of an HTML page:</p>
		<pre>&lt;script src="Soap.js" language="Javascript" type="text/javascript">&lt;/script&gt;
&lt;script src="<xsl:value-of select="$serviceName"/>.js" language="Javascript" type="text/javascript">&lt;/script&gt;</pre>
		
		<p>Then in your code, instantiate the class:</p>
		<code>var service=new Namespace.Service();</code>

		<p>
			Now the instantiated class has a whole bunch of methods associated with it.
			Service classes can also be set to use custom URLs, send SOAP headers, etc... but for now, we will keep it simple.
			Let's say you have a method to find widgets called "Find".
			You would call that method like this:
		</p>
		<code>var handler=service.Find("test", 5);</code>
		<p>
			To handle the results from the web service, you set a function for the onload method of the handler.
		</p>
		<pre>handler.onload=function(value) {
	window.alert(value);
}
</pre>

		<p>So in this example, the "onload" method handles any response that calling the Find method creates.  
		Each request can return either an error (like could not resolve the domain name for instance), 
		a SoapFault (an error occurred in your code on the server), or the actual result.  To handle an error we can do this:
		</p>
		<pre>handler.onerror=function(error) {
	window.alert(error);
}
</pre>
		
		<p>Soap faults are handled the same way.</p>
		<pre>handler.onfault=function(fault) {
	window.alert(fault);
}
</pre>

		<p>
			Hopefully this gets you started in your development.  
			Be sure to check out the documentation for more details.
		</p>
	</body>
</html>